
import java.util.*;


public class Test12 {



    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        // 注意 hasNext 和 hasNextLine 的区别
        while (in.hasNext()) {
            int n=in.nextInt();
            String str=in.next();

            int s=0;
            int h=0;
            int y=0;
            for(int i=0;i<n;i++){
                if(str.charAt(i) == 's'){
                    s++;
                }
                if(str.charAt(i) == 'h'){
                    h++;
                }
                if(str.charAt(i) == 'y'){
                    y++;
                }
            }

            System.out.println(s*h*y);
        }
    }



    public static class ListNode {
        int val;
        ListNode next = null;

        ListNode(int val) {
            this.val = val;
        }
    }

    public static void main02(String[] args) {
        ListNode cur1=new ListNode(1);
        cur1.next=new ListNode(2);
        cur1.next.next=new ListNode(3);
        cur1.next.next.next=new ListNode(6);
        cur1.next.next.next.next=new ListNode(7);
        ListNode cur2=new ListNode(4);
        cur2.next=new ListNode(5);
        cur2.next.next=new ListNode(6);
        cur2.next.next.next=new ListNode(7);

        FindFirstCommonNode(cur1,cur2);
    }
    public static ListNode FindFirstCommonNode(ListNode pHead1, ListNode pHead2) {
        ListNode cur1 = pHead1;
        int len1 = 0;
        ListNode cur2 = pHead2;
        int len2 = 0;
        while (cur1 != null) {
            len1++;
            cur1 = cur1.next;
        }
        while (cur2 != null) {
            len2++;
            cur2 = cur2.next;
        }
        if (len1 > len2) {
            int len = len1 - len2;
            cur1 = pHead1;
            while (len-- != 0) {
                cur1 = cur1.next;
            }
            cur2 = pHead2;
            while (cur1 != cur2) {
                cur1 = cur1.next;
                cur2 = cur2.next;
            }
        } else {
            int len = len2 - len1;
            cur2 = pHead2;
            while (len-- != 0) {
                cur2 = cur2.next;
            }
            cur1 = pHead1;
            while (cur1 != cur2) {
                cur1 = cur1.next;
                cur2 = cur2.next;
            }
        }

        return cur1;
    }
}
